<template>
	<div class="marketContentZong">
	 <div style="overflow: auto;">
	 	<div class="marketContent" v-for="(item,index) in marketCoupon" @click="choType(item)">
	    <div class="marketCoupon">
	    	<img  v-lazy="item.mchtLogUrl"/>
	    	<div class="couponDiv">
	          <coupon-denomination :item="item"></coupon-denomination>
	        </div>
	    </div>
	    <p>{{item.name}}</p>
	    <p>{{item.mchtName}}</p> 
	  </div>
	 </div>
	 
	  <!--<div class="seeAll" v-if="findAllState">查看全部</div>-->
  </div>
</template>
   
<script>
  import {Storage} from 'src/utils/storage.js'
  import getData4 from '../../service/getData4.js'
  export default {
      data: () => ({
      	cityName:Storage.get('city', true)
      }),
      methods: {},
      components: {

      },
      created(){

      },
      props: {
		    marketCoupon: {
		      type: Array,
		      default: () => []
		    },
		    //判断是否有定位
		     positionState: {
		      type: Boolean,
		      default: false
		    },
		    //判断是否有查看全部
		     findAllState: {
		      type: Boolean,
		      default: false
		    },
		    title1:[String],
		    title2:[String],
      },
      methods: {
	 choType(info) { //赋值，跳转兑换券页面
	 	this.$store.commit('changeState', true)
	 	getData4.findSeqno({couponId: info.couponId,mchtId:info.mchtId}).then(res=>{
	 		if(res.content.list.length!=0){
	 			info.id=res.content.list[0].id
	 			info.usrId=res.content.list[0].usrId
	 				Storage.set('couponInfo', info, false);
			        this.$router.push({
			          path: "/exchange",
			          query: {
			            surplusnum: info.sellNum
			          }
			      })
	 		}else{
	 			  this.$router.push({
		          name: 'couDetail',
		          query: {
		            seq:  '',
		            couponId: info.couponId,
		            mchtId: info.mchtId,
		            usrPicId: '',
		            usrId: res.usrId || res.sellUsr || '' // 挂单用户ID
		          }
		        });
	 		}
	 	})
       
      }
  }
  }
</script>

<style scoped="scoped" lang="scss">
  .marketContentZong{
  	position: relative;
  	background: #FFFFFF;
  	padding: 0 0 0 1rem;
  	.marketContent{
  		width: 48%;
  		float: left;
  		position: relative;
  		margin-right: 1%;
  		margin-bottom: 1rem;
  		p{
  			line-height: 1.4rem;
  			color: rgb(74,74,74);
  			font-size: 14px;
				font-weight: 600;
  			margin-top: .4rem;
  			&:nth-of-type(2){
					font-weight: 400;
					font-size: 12px;
  				color: rgb(153,153,153);
  				margin: 0;
  			}
  		}
  		.marketCoupon{
  			height:7.2rem;
  			.couponDiv{
  				float: right;
  				margin: 0;
  				height: 3.5rem;
  			}
  			& img{
  				width: 100%;
  				height: 7.2rem;
  				background-size: 100%;
  			}
  		}
  	}
  	& .seeAll{

  		text-align: center;
  		/*line-height: 3rem;*/
  		height: 2rem;
  		color: #333333;
  	}
  }
  .couponDiv{
  	position: absolute;
  	right: 0;
  	top: 0;
  }
</style>
